import { Module } from "vuex"
import { RootProps } from "../index";

interface GoodsProps {
    num: number
    imgSrc: string
    name: string
    price: number
    online: string
    tag: string
    sales: number
    type: string
}

export interface GoodsArrayProps {
    tableData: GoodsProps[]
}

const shopState: Module<GoodsArrayProps, RootProps> = {
    actions: {
        setDataList({commit}, data){
            commit("setDataList", data)
        }
    },
    mutations: {
        setUserList(state, data){
            state.tableData = data;
        }
    },
    state: {
        tableData:[{
            num: 1,
            imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
            name: "健身哑铃",
            price: 100,
            online: "已上线",
            tag: "无",
            sales: 1000,
            type: '实物商品'
          },
          {
            num: 2,
            imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
            name: "健身哑铃",
            price: 200,
            online: "下架",
            tag: "无",
            sales: 1000,
            type: '虚拟物品'
          },
          {
            num: 3,
            imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
            name: "健身哑铃",
            price: 400,
            online: "已上线",
            tag: "无",
            sales: 1000,
            type: '积分兑换商品'
          },
          {
            num: 4,
            imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
            name: "健身哑铃",
            price: 700,
            online: "已上线",
            tag: "无",
            sales: 1000,
            type: '虚拟物品'
          },
          {
            num: 5,
            imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
            name: "健身哑铃",
            price: 8888,
            online: "下架",
            tag: "无",
            sales: 1000,
            type: '积分兑换商品'
          },
          {
            num: 6,
            imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
            name: "健身哑铃",
            price: 9999,
            online: "已上线",
            tag: "无",
            sales: 1000,
            type: '虚拟物品'
          },
          {
            num: 7,
            imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
            name: "健身哑铃",
            price: 777778,
            online: "下架·",
            tag: "无",
            sales: 1000,
            type: '实物商品'
          }]
    },
    getters: {
        allDateList(state){
            return state.tableData
        }
    }
}

export default shopState